/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tmp.ac.myInterface;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.naming.spi.DirStateFactory;
import tmp.ac.lib.tools.DBClass;
import tmp.ac.lib.tools.uiUtil;
import tmp.ac.options.DataModel;

/**
 *
 * @author ismail
 */
public class myIndex {

    DBClass db = new DBClass();

   

    public ArrayList<String> getMenuCategories() throws SQLException {
        ArrayList<String> returnData = new ArrayList<String>();
        db.setOpenCon();


        ResultSet res = db.getDataWithOutCon(DataModel.MENU_CATEGORIES);
        while (res.next()) {
            returnData.add(res.getString("id")
                    + ";" + res.getString("title")
                    + ";" + res.getString("des")
                    + ";" + res.getString("highlightColor"));
        }

        db.setCloseCon();
        return returnData;
    }

    public ArrayList<String> getMenuIemes(String catid) throws SQLException {
        ArrayList<String> returnData = new ArrayList<String>();
        db.setOpenCon();
        ResultSet res = db.getDataWithOutCon(DataModel.MENU_ITEMS, "", "catid='" + catid + "'");
        while (res.next()) {
            returnData.add(res.getString("id") + ";"
                    + res.getString("title") + ";"
                    + res.getString("catid") + ";"
                    + res.getString("title") + ";"
                    + res.getString("image") + ";"
                    + res.getString("link") + ";"
                    + res.getString("des") + ";"
                    + res.getString("status") + ";"
                    + res.getString("width") + ";"
                    + res.getString("height") + ";");
        }

        db.setCloseCon();
        return returnData;
    }
}
